function [_ARCS,_ELLIPSES,_POINTS,_LINES,_LWPOLYLINES,_POLYLINES,_3DFACES,_CIRCLES,_TEXTS,_MTEXTS,_IMAGES] = dxf2sci(dxffile)

    ////////////////////////////////////////////////////////////////////////////////
    /// name: dxf2sci                                                              /
    /// filename: dxf2sci_0_1.sci                                                 /
    /// version: 0.1                                                               /
    /// status: beta but seems to work pretty good                                 /
    /// author: lukas wischounig                                                   /
    /// license: CeCILL-C                                                          /
    /// date: october - november 2010                                              /
    /// platform: scilab 5.3.0 (1) (written & tested on)                           /
    /// os: win7-64 (written & tested on)                                          /
    /// input: dxf file, versions r2004 - r2007 (2010??)                           /
    /// output: variables in the scilab workspace                                  /
    /// keywords: cad, autocad, dxf                                                /
    ////////////////////////////////////////////////////////////////////////////////
    ///                                                                            /
    /// remarks:                                                                   /
    ///                                                                            /
    /// dxf and autocad are trademarks of autodesk(r) inc.                         /
    ///                                                                            /
    ////////////////////////////////////////////////////////////////////////////////
    ///
    /// description:
    /// this is a very simple dxf reader for dxf(r) files. (in general: when you
    /// save a file in autocad(r) as .dxf it will be ascii dxf automatically. in
    /// some other cad platforms [like e.g. progecad] you have to choose ascii or
    /// binary dxf explicit).
    /// supported formats --> developed for 2004, should work for 2000 -
    /// 2010 (try out) the script reads entities from an ascii dxf(r) file so
    /// they can be used as scilab variables. A entity group (e.g. points) is
    /// saved as a list where one entity within this list is a tlist.
    /// supported entities are: ARCS, ELLIPSES, POINTS, LINES, LWPOLYLINES, POLYLINES,
    /// 3DFACES,CIRCLES, TEXTS, MTEXTS and IMAGES.
    /// at closed lwpolylines or polylines (2d & 3d) the first coordinates are equal
    /// to the last ones
    ///
    /// call the entities with e.g.
    /// POLYLINES(7).entries.x_coords (available stuff see lines 63 - 72)
    /// for closed entities (e.g. polylines) the last coords equal to the first
    /// for further information refer to the autodesk(r) dxf(r) reference.
    ///
    ////////////////////////////////////////////////////////////////////////////////
    ///
    /// history:
    ///
    /// 2005 and later: previous versions for matlab
    /// version 0.1_beta: rewritten from scratch for scilab           oct - nov 2010
    ///
    ////////////////////////////////////////////////////////////////////////////////
    ///
    // TODO:
    //$ANGBASE?? checken
    //$ANGDIR?? checken
    //$AUNITS?? checken
    // TODO main loop halbieren! 1 x entities / 1 x objects
    // version check
    // blocks and blockdefinitions
    ///
    ////////////////////////////////////////////////////////////////////////////////

    ////////////////////////////////////////////////////////////////////////////////
    // create empty data containers
    _ARC = tlist(["ARC","id","x_coords","y_coords","z_coords","radius","start_angle","end_angle","layer","colour"]);
    _ELLIPSE = tlist(["ELLIPSE","id","center_x_coords","center_y_coords","center_z_coords","ep_maj_x","ep_maj_y","ep_maj_z","minor_to_major_ratio","start_parameter","end_parameter","layer","colour"]);
    _POINT = tlist(["POINT","id","x_coords","y_coords","z_coords","layer","colour"]);
    _LINE = tlist(["LINE","id","x_coords","y_coords","z_coords","layer","colour"]);
    _LWPOLYLINE = tlist(["LWPOLYLINE","id","x_coords","y_coords","bulge","elevation","layer","colour"]);
    _POLYLINE = tlist(["POLYLINE","id","x_coords","y_coords","z_coords","layer","colour"]);
    _3DFACE = tlist(["3DFACE","id","x_coords","y_coords","z_coords","layer","colour"]);
    _CIRCLE = tlist(["CIRCLE","id","x_coords","y_coords","z_coords","radius","layer","colour"]);
    _TEXT = tlist(["TEXT","id","x_coords","y_coords","z_coords","text_string","text_height","text_rotation","text_style","layer","colour"]);
    _MTEXT = tlist(["TEXT","id","x_coords","y_coords","z_coords","text_string","text_height","text_rotation","text_style","layer","colour"]);
    _IMAGE = tlist(["IMAGE","id","x_coords","y_coords","u_vec_x","u_vec_y","v_vec_x","v_vec_y","u_pixels","v_pixels","name","path","layer"]);

    // create basic list structure (output vars)
    _ARCS = list(_ARC);
    _ELLIPSES = list(_ELLIPSE);
    _POINTS = list(_POINT);
    _LINES = list(_LINE);
    _LWPOLYLINES = list(_LWPOLYLINE);
    _POLYLINES = list(_POLYLINE);
    _3DFACES = list(_3DFACE);
    _CIRCLES = list(_CIRCLE);
    _TEXTS = list(_TEXT);
    _MTEXTS = list(_MTEXT);
    _IMAGES = list(_IMAGE);

    // preallocate some temp_vars
    temp_closed = [];
    count = [];

    // set counters
    _ARC_count = 1;
    _ELLIPSE_count = 1;
    _POINT_count = 1;
    _LINE_count = 1;
    _LWPOLYLINE_count = 1;
    _POLYLINE_count = 1;
    _3DFACE_count = 1;
    _CIRCLE_count = 1;
    _TEXT_count = 1;
    _MTEXT_count = 1;
    _IMAGE_count = 1;


    // set additional var
    case_ = "";

    ///////////////////////////////////////////////////////////////////// open file

    [fd] = mopen(dxffile,'r');

    dxfline = mgetl(fd,1);

    while dxfline ~="EOF" // main loop

        dxfline = mgetl(fd,1);

        if dxfline == "ENTITIES" then// switch to case entities
            case_ = "ENTITIES";
        elseif dxfline == "ENDSEC" & case_ == "ENTITIES" then// reset with next endsec
            case_ = "";
        end

        if dxfline == "OBJECTS" then// switch to case objects
            case_ = "OBJECTS";
        elseif dxfline == "ENDSEC" & case_ == "OBJECTS" then// reset with next endsec
            case_ = "";
        end
        ////////////////////////////////////////////////////////////////

        ///////////////////////////begin ENTITIES  /////////////////////////////////////
        if case_ == "ENTITIES" then

            ///////////////////////////begin Entity Extraction  ////////////////////////////
            select dxfline

            case "ARC" then

                _ARCS(_ARC_count).id = _ARC_count;
                _ARCS(_ARC_count).colour = ["BYLAYER"];

                while dxfline ~="  0"
                    if dxfline == " 10" then
                        _ARCS(_ARC_count).x_coords = evstr(mgetl(fd,1));
                    elseif dxfline == " 20" then
                        _ARCS(_ARC_count).y_coords = evstr(mgetl(fd,1));
                    elseif dxfline == " 30" then
                        _ARCS(_ARC_count).z_coords = evstr(mgetl(fd,1));
                    elseif dxfline == " 40" then
                        _ARCS(_ARC_count).radius = evstr(mgetl(fd,1));
                    elseif dxfline == " 50" then
                        _ARCS(_ARC_count).start_angle = evstr(mgetl(fd,1));
                    elseif dxfline == " 51" then
                        _ARCS(_ARC_count).end_angle = evstr(mgetl(fd,1));
                    elseif dxfline == " 62" then
                        _ARCS(_ARC_count).colour = mgetl(fd,1);
                    elseif dxfline == "  8" then
                        _ARCS(_ARC_count).layer = mgetl(fd,1);
                    end
                    dxfline = mgetl(fd,1);
                end

                _ARCS($+1) = _ARC;
                _ARC_count = _ARC_count + 1;


            case "ELLIPSE" then

                _ELLIPSES(_ELLIPSE_count).id = _ELLIPSE_count;
                _ELLIPSES(_ELLIPSE_count).colour = ["BYLAYER"];

                while dxfline ~="  0"
                    if dxfline == " 10" then
                        _ELLIPSES(_ELLIPSE_count).center_x_coords = evstr(mgetl(fd,1));
                    elseif dxfline == " 20" then
                        _ELLIPSES(_ELLIPSE_count).center_y_coords = evstr(mgetl(fd,1));
                    elseif dxfline == " 30" then
                        _ELLIPSES(_ELLIPSE_count).center_z_coords = evstr(mgetl(fd,1));
                    elseif dxfline == " 11" then
                        _ELLIPSES(_ELLIPSE_count).ep_maj_x = evstr(mgetl(fd,1));
                    elseif dxfline == " 21" then
                        _ELLIPSES(_ELLIPSE_count).ep_maj_y = evstr(mgetl(fd,1));
                    elseif dxfline == " 31" then
                        _ELLIPSES(_ELLIPSE_count).ep_maj_z = evstr(mgetl(fd,1));
                    elseif dxfline == " 40" then
                        _ELLIPSES(_ELLIPSE_count).minor_to_major_ratio = evstr(mgetl(fd,1));
                    elseif dxfline == " 41" then
                        _ELLIPSES(_ELLIPSE_count).start_parameter = evstr(mgetl(fd,1));
                    elseif dxfline == " 42" then
                        _ELLIPSES(_ELLIPSE_count).end_parameter = evstr(mgetl(fd,1));
                    elseif dxfline == " 62" then
                        _ELLIPSES(_ELLIPSE_count).colour = mgetl(fd,1);
                    elseif dxfline == "  8" then
                        _ELLIPSES(_ELLIPSE_count).layer = mgetl(fd,1);
                    end
                    dxfline = mgetl(fd,1);
                end

                _ELLIPSES($+1) = _ELLIPSE;
                _ELLIPSE_count = _ELLIPSE_count+1;


            case "POINT" then

                _POINTS(_POINT_count).id = _POINT_count;
                _POINTS(_POINT_count).colour = ["BYLAYER"];

                while dxfline ~="  0"
                    if dxfline == " 10" then
                        _POINTS(_POINT_count).x_coords = evstr(mgetl(fd,1));
                    elseif dxfline == " 20" then
                        _POINTS(_POINT_count).y_coords = evstr(mgetl(fd,1));
                    elseif dxfline == " 30" then
                        _POINTS(_POINT_count).z_coords = evstr(mgetl(fd,1));
                    elseif dxfline == "  8" then
                        _POINTS(_POINT_count).layer = mgetl(fd,1);
                    elseif dxfline == " 62" then
                        _POINTS(_POINT_count).colour  = mgetl(fd,1);
                    end
                    dxfline = mgetl(fd,1);
                end

                _POINTS($+1) = _POINT;
                _POINT_count = _POINT_count+1;

            case "LINE" then

                _LINES(_LINE_count).id = _LINE_count;
                _LINES(_LINE_count).colour = ["BYLAYER"];

                while dxfline ~="  0"
                    if dxfline == " 10" then
                        _LINES(_LINE_count).x_coords = evstr(mgetl(fd,1));
                    elseif dxfline == " 20" then
                        _LINES(_LINE_count).y_coords = evstr(mgetl(fd,1));
                    elseif dxfline == " 30" then
                        _LINES(_LINE_count).z_coords = evstr(mgetl(fd,1));
                    elseif dxfline == " 11" then
                        _LINES(_LINE_count).x_coords($+1) = evstr(mgetl(fd,1));
                    elseif dxfline == " 21" then
                        _LINES(_LINE_count).y_coords($+1) = evstr(mgetl(fd,1));
                    elseif dxfline == " 31" then
                        _LINES(_LINE_count).z_coords($+1) = evstr(mgetl(fd,1));
                    elseif dxfline == "  8" then
                        _LINES(_LINE_count).layer = mgetl(fd,1);
                    elseif dxfline == " 62" then
                        _LINES(_LINE_count).colour = mgetl(fd,1);
                    end
                    dxfline = mgetl(fd,1);
                end

                _LINES($+1) = _LINE;
                _LINE_count = _LINE_count+1;

            case "LWPOLYLINE" then

                _LWPOLYLINES(_LWPOLYLINE_count).id = _LWPOLYLINE_count;
                _LWPOLYLINES(_LWPOLYLINE_count).colour = ["BYLAYER"];
                _LWPOLYLINES(_LWPOLYLINE_count).elevation = 0;

                while dxfline ~="  0"
                    if dxfline == " 10" then
                        _LWPOLYLINES(_LWPOLYLINE_count).x_coords($+1) = evstr(mgetl(fd,1));
                        _LWPOLYLINES(_LWPOLYLINE_count).bulge($+1) = 0;
                    elseif dxfline == " 20" then
                        _LWPOLYLINES(_LWPOLYLINE_count).y_coords($+1) = evstr(mgetl(fd,1));
                        _LWPOLYLINES(_LWPOLYLINE_count).bulge($+1) = 0;
                    elseif dxfline == " 42" then
                        _LWPOLYLINES(_LWPOLYLINE_count).bulge($+1) = evstr(mgetl(fd,1));
                    elseif dxfline == " 70" then
                        temp_closed = mgetl(fd,1);
                    elseif dxfline == " 38" then
                        _LWPOLYLINES(_LWPOLYLINE_count).elevation = evstr(mgetl(fd,1));
                    elseif dxfline == "  8" then
                        _LWPOLYLINES(_LWPOLYLINE_count).layer = mgetl(fd,1);
                    elseif dxfline == " 62" then
                        _LWPOLYLINES(_LWPOLYLINE_count).colour = mgetl(fd,1);
                    end
                    dxfline = mgetl(fd,1);
                end

                if temp_closed == "     1" then // if Polyline is closed //TODO dec2bin
                    _LWPOLYLINES(_LWPOLYLINE_count).x_coords($+1) = _LWPOLYLINES(_LWPOLYLINE_count).x_coords(1);
                    _LWPOLYLINES(_LWPOLYLINE_count).y_coords($+1) = _LWPOLYLINES(_LWPOLYLINE_count).y_coords(1);
                end

                temp_closed = [];
                _LWPOLYLINES($+1) = _LWPOLYLINE;
                _LWPOLYLINE_count = _LWPOLYLINE_count+1;

            case "POLYLINE" then

                _POLYLINES(_POLYLINE_count).id = _POLYLINE_count;
                _POLYLINES(_POLYLINE_count).colour = ["BYLAYER"];

                while dxfline ~="SEQEND"
                    if dxfline == " 10" then
                        _POLYLINES(_POLYLINE_count).x_coords($+1) = evstr(mgetl(fd,1));
                    elseif dxfline == " 20" then
                        _POLYLINES(_POLYLINE_count).y_coords($+1) = evstr(mgetl(fd,1));
                    elseif dxfline == " 30" then
                        _POLYLINES(_POLYLINE_count).z_coords($+1) = evstr(mgetl(fd,1));
                    elseif dxfline == " 70" & isempty(temp_closed) then // take only the first 70, rest comes from VERTEX entities -> ignore
                        temp_closed = mgetl(fd,1);
                    elseif dxfline == "  8" then
                        _POLYLINES(_POLYLINE_count).layer = mgetl(fd,1);
                    elseif dxfline == " 62" then
                        _POLYLINES(_POLYLINE_count).colour = mgetl(fd,1);
                    end
                    dxfline = mgetl(fd,1);
                end

                _POLYLINES(_POLYLINE_count).x_coords(1) =[]; // ignore, the first one is always 0
                _POLYLINES(_POLYLINE_count).y_coords(1) =[];
                _POLYLINES(_POLYLINE_count).z_coords(1) =[];

                temp_closed = dec2bin(evstr(temp_closed));
                if part(temp_closed,4) == "1" then // if Polyline is closed
                    _POLYLINES(_POLYLINE_count).x_coords($+1) = _POLYLINES(_POLYLINE_count).x_coords(1);
                    _POLYLINES(_POLYLINE_count).y_coords($+1) = _POLYLINES(_POLYLINE_count).y_coords(1);
                    _POLYLINES(_POLYLINE_count).z_coords($+1) = _POLYLINES(_POLYLINE_count).z_coords(1);
                end

                _POLYLINES($+1) = _POLYLINE;
                _POLYLINE_count = _POLYLINE_count+1;
                temp_closed = [];


            case "3DFACE" then

                _3DFACES(_3DFACE_count).id = _3DFACE_count;
                _3DFACES(_3DFACE_count).colour = ["BYLAYER"];

                while dxfline ~="  0"
                    if dxfline == " 10" then
                        _3DFACES(_3DFACE_count).x_coords($+1) = evstr(mgetl(fd,1));
                    elseif dxfline == " 20" then
                        _3DFACES(_3DFACE_count).y_coords($+1) = evstr(mgetl(fd,1));
                    elseif dxfline == " 30" then
                        _3DFACES(_3DFACE_count).z_coords($+1) = evstr(mgetl(fd,1));
                    elseif dxfline == " 11" then
                        _3DFACES(_3DFACE_count).x_coords($+1) = evstr(mgetl(fd,1));
                    elseif dxfline == " 21" then
                        _3DFACES(_3DFACE_count).y_coords($+1) = evstr(mgetl(fd,1));
                    elseif dxfline == " 31" then
                        _3DFACES(_3DFACE_count).z_coords($+1) = evstr(mgetl(fd,1));
                    elseif dxfline == " 12" then
                        _3DFACES(_3DFACE_count).x_coords($+1) = evstr(mgetl(fd,1));
                    elseif dxfline == " 22" then
                        _3DFACES(_3DFACE_count).y_coords($+1) = evstr(mgetl(fd,1));
                    elseif dxfline == " 32" then
                        _3DFACES(_3DFACE_count).z_coords($+1) = evstr(mgetl(fd,1));
                    elseif dxfline == " 13" then
                        _3DFACES(_3DFACE_count).x_coords($+1) = evstr(mgetl(fd,1));
                    elseif dxfline == " 23" then
                        _3DFACES(_3DFACE_count).y_coords($+1) = evstr(mgetl(fd,1));
                    elseif dxfline == " 33" then
                        _3DFACES(_3DFACE_count).z_coords($+1) = evstr(mgetl(fd,1));
                    elseif dxfline == "  8" then
                        _3DFACES(_3DFACE_count).layer = mgetl(fd,1);
                    elseif dxfline ==  " 62" then
                        _3DFACES(_3DFACE_count).colour = mgetl(fd,1);
                    end
                    dxfline = mgetl(fd,1);
                end

                _3DFACES($+1) = _3DFACE;
                _3DFACE_count = _3DFACE_count+1;

            case "CIRCLE" then

                _CIRCLES(_CIRCLE_count).id = _CIRCLE_count;
                _CIRCLES(_CIRCLE_count).colour = ["BYLAYER"];

                while dxfline ~="  0"
                    if dxfline == " 10" then
                        _CIRCLES(_CIRCLE_count).x_coords = evstr(mgetl(fd,1));
                    elseif dxfline == " 20" then
                        _CIRCLES(_CIRCLE_count).y_coords = evstr(mgetl(fd,1));
                    elseif dxfline == " 30" then
                        _CIRCLES(_CIRCLE_count).z_coords = evstr(mgetl(fd,1));
                    elseif dxfline == " 40" then
                        _CIRCLES(_CIRCLE_count).radius = evstr(mgetl(fd,1));
                    elseif dxfline == "  8" then
                        _CIRCLES(_CIRCLE_count).layer = mgetl(fd,1);
                    elseif dxfline == " 62" then
                        _CIRCLES(_CIRCLE_count).colour = mgetl(fd,1);
                    end
                    dxfline = mgetl(fd,1);
                end

                _CIRCLES($+1) = _CIRCLE;
                _CIRCLE_count = _CIRCLE_count+1;

            case "TEXT" then

                _TEXTS(_TEXT_count).id = _TEXT_count;
                _TEXTS(_TEXT_count).colour = ["BYLAYER"];
                _TEXTS(_TEXT_count).text_style = ["STANDARD"];
                _TEXTS(_TEXT_count).text_rotation = 0;

                while dxfline ~="  0"
                    if dxfline == " 10" then
                        _TEXTS(_TEXT_count).x_coords = evstr(mgetl(fd,1));
                    elseif dxfline == " 20" then
                        _TEXTS(_TEXT_count).y_coords = evstr(mgetl(fd,1));
                    elseif dxfline == " 30" then
                        _TEXTS(_TEXT_count).z_coords = evstr(mgetl(fd,1));
                    elseif dxfline == "  1" then
                        _TEXTS(_TEXT_count).text_string = mgetl(fd,1);
                    elseif dxfline == " 40" then
                        _TEXTS(_TEXT_count).text_height = evstr(mgetl(fd,1));
                    elseif dxfline == " 50" then
                        _TEXTS(_TEXT_count).text_rotation = evstr(mgetl(fd,1));
                    elseif dxfline == "  7" then
                        _TEXTS(_TEXT_count).text_style = mgetl(fd,1);
                    elseif dxfline == "  8" then
                        _TEXTS(_TEXT_count).layer = mgetl(fd,1);
                    elseif dxfline == " 62" then
                        _TEXTS(_TEXT_count).colour = mgetl(fd,1);
                    end
                    dxfline = mgetl(fd,1);
                end

                _TEXTS($+1) = _TEXT;
                _TEXT_count = _TEXT_count+1;

            case "MTEXT" then

                _MTEXTS(_MTEXT_count).id = _MTEXT_count;
                _MTEXTS(_MTEXT_count).colour = ["BYLAYER"];
                _MTEXTS(_MTEXT_count).text_style = ["STANDARD"];
                _MTEXTS(_MTEXT_count).text_rotation = 0;

                while dxfline ~="  0"
                    if dxfline == " 10" then
                        _MTEXTS(_MTEXT_count).x_coords = evstr(mgetl(fd,1));
                    elseif dxfline == " 20" then
                        _MTEXTS(_MTEXT_count).y_coords = evstr(mgetl(fd,1));
                    elseif dxfline == " 30" then
                        _MTEXTS(_MTEXT_count).z_coords = evstr(mgetl(fd,1));
                    elseif dxfline == "  1" then
                        _MTEXTS(_MTEXT_count).text_string($+1) = mgetl(fd,1);
                    elseif dxfline == "  3" then
                        _MTEXTS(_MTEXT_count).text_string($+1) = mgetl(fd,1); // append string
                    elseif dxfline == " 40" then
                        _MTEXTS(_MTEXT_count).text_height = mgetl(fd,1);
                    elseif dxfline == " 50" then
                        _MTEXTS(_MTEXT_count).text_rotation = evstr(mgetl(fd,1));
                    elseif dxfline == "  7" then
                        _MTEXTS(_MTEXT_count).text_style = mgetl(fd,1);
                    elseif dxfline == "  8" then
                        _MTEXTS(_MTEXT_count).layer = mgetl(fd,1);
                    elseif dxfline == " 62" then
                        _MTEXTS(_MTEXT_count).colour = mgetl(fd,1);
                    end
                    dxfline = mgetl(fd,1);
                end

                _MTEXTS($+1) = _MTEXT;
                _MTEXT_count = _MTEXT_count+1;


            case "IMAGE" then

                _IMAGES(_IMAGE_count).id = _IMAGE_count;
                _IMAGES(_IMAGE_count).name = mgetl(fd,1);

                while dxfline ~="  0"
                    if dxfline == " 10" then
                        _IMAGES(_IMAGE_count).x_coords = evstr(mgetl(fd,1));
                    elseif dxfline == " 20" then
                        _IMAGES(_IMAGE_count).y_coords = evstr(mgetl(fd,1));
                    elseif dxfline == " 11" then
                        _IMAGES(_IMAGE_count).u_vec_x = evstr(mgetl(fd,1));
                    elseif dxfline == " 21" then
                        _IMAGES(_IMAGE_count).u_vec_y = evstr(mgetl(fd,1));
                    elseif dxfline == " 12" then
                        _IMAGES(_IMAGE_count).v_vec_x = evstr(mgetl(fd,1));
                    elseif dxfline == " 22" then
                        _IMAGES(_IMAGE_count).v_vec_y = evstr(mgetl(fd,1));
                    elseif dxfline == " 13" then
                        _IMAGES(_IMAGE_count).u_pixels = evstr(mgetl(fd,1));
                    elseif dxfline == " 23" then
                        _IMAGES(_IMAGE_count).v_pixels = evstr(mgetl(fd,1));
                    elseif dxfline == "340" then
                        _IMAGES(_IMAGE_count).path = mgetl(fd,1); // at this moment _image(x).path = handle
                    elseif dxfline == "  8" then
                        _IMAGES(_IMAGE_count).layer = mgetl(fd,1);
                    end
                    dxfline = mgetl(fd,1);
                end

                _IMAGES($+1) = _IMAGE;
                _IMAGE_count = _IMAGE_count + 1;

            end
        end
        ///////////////////////////end Entity Extraction  ////////////////////////////

        ///////////////////////////begin OBJECTS Extraction /////////////////////////////////////

        if case_ == "OBJECTS" then // only needed for IMAGES, skip this if you don't need

            select dxfline

            case "IMAGEDEF" then // get image path(s)

                while dxfline ~="  0"
                    if dxfline == "  5" then
                        temp_image_handle($+1) = mgetl(fd,1);
                    elseif dxfline == "  1" then
                        temp_image_path($+1) = mgetl(fd,1);
                    end
                    dxfline = mgetl(fd,1);
                end
            end
        end

        ///////////////////////////end OBJECTS Extraction /////////////////////////////////////

    end // end main loop

    mclose(fd); // close dxf file


    ///////////////// begin some corrections and supplementations //////////////////
    _ARCS($) = null(); // delete last number --> _ARCS($+1) = _ARC;
    _ELLIPSES($) = null();
    _POINTS($) = null();
    _LINES($) = null();
    _LWPOLYLINES($) = null();
    _POLYLINES($) = null();
    _3DFACES($) = null();
    _CIRCLES($) = null();
    _TEXTS($) = null();
    _MTEXTS($) = null();
    _IMAGES($) = null();

    if isempty(_IMAGES) == %f then

        for count = 1:length(_IMAGES)
            _IMAGES(count).path = temp_image_path(grep(temp_image_handle,_IMAGES(count).path)); // replace handle with pathname
            [temp_image_path_2,temp_image_filename,temp_image_extension] = fileparts(_IMAGES(count).path); // extract image name..
            _IMAGES(count).name = temp_image_filename + temp_image_extension;// .. and set it
        end
    end
    ///////////////////////////end some Corrections  /////////////////////////////////////
endfunction
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
